def is_number(s):
    try:
        int(s)
        if int(s)>0:
            return False
        else:
            return True
    except ValueError:
        return True
class Fib:
    def __init__(self,times):
        if is_number(times):
            raise FibError("pls input positive number")
        self.times=times
        self.a=0
        self.b=1
        self.counter=0

    def __iter__(self):
        return self

    def __next__(self):
        if self.counter<self.times:
            self.a,self.b=self.b,self.a+self.b
            self.counter+=1
            return self.a
        else:
            raise StopIteration
class FibError(Exception):
    def __init__(self,info):
        self.info=info
    def __str__(self):
        return self.info

fib = Fib(10)
# class A:
#     def __init__(self,info):
#         self.info = info
#     def __str__(self):
#         return self.info
#
# a = A("this is A")
# print(a)